/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

/**
 *
 * @author admin
 */
public class Wisata {
    private String idPaket;
    public String NamaPaket, Rute, Harga, NamaTourGuide, TanggalBerangkat, JamBerangkat, JamPulang, cover;
    public int harga, kuota;
    private int keraton = 0;
    private int benteng = 0;
    private int pantai = 0;
    private int malioboro = 0;
    private int desa = 0;



//   public String getpaket1() {
//        if (paket.equals("Kraton")) {
//            setKeraton(450000);
//            return "paket";
//        } else {
//            return null;
//        }
//    }
//
//
//
//
//
//    public Wisata() {
//    }
//
    
    /**
     * @return the namaPaket
     */
    public String getNamaPaket() {
        return NamaPaket;
    }

    /**
     * @param namaPaket the namaPaket to set
     */
    public void setNamaPaket(String namaPaket) {
        this.NamaPaket = namaPaket;
    }

    /**
     * @return the harga
     */
    public int getHarga() {
        return harga;
    }

    /**
     * @param harga the harga to set
     */
    public void setHarga(int harga) {
        this.harga = harga;
    }

    /**
     * @return the paket
     */
//    public String getPaket1() {
//        return paket;
//    }
//
//    /**
//     * @param paket the paket to set
//     */
//    public void setPaket1(String paket1) {
//        this.paket = paket1;
//    }

    

    /**
     * @return the keraton
     */
    public int getKeraton() {
        return keraton;
    }

    /**
     * @param keraton the keraton to set
     */
    public void setKeraton(int keraton) {
        this.keraton = keraton;
    }

    /**
     * @return the benteng
     */
    public int getBenteng() {
        return benteng;
    }

    /**
     * @param benteng the benteng to set
     */
    public void setBenteng(int benteng) {
        this.benteng = benteng;
    }

    /**
     * @return the pantai
     */
    public int getPantai() {
        return pantai;
    }

    /**
     * @param pantai the pantai to set
     */
    public void setPantai(int pantai) {
        this.pantai = pantai;
    }

    /**
     * @return the malioboro
     */
    public int getMalioboro() {
        return malioboro;
    }

    /**
     * @param malioboro the malioboro to set
     */
    public void setMalioboro(int malioboro) {
        this.malioboro = malioboro;
    }

    /**
     * @return the desa
     */
    public int getDesa() {
        return desa;
    }

    /**
     * @param desa the desa to set
     */
    public void setDesa(int desa) {
        this.desa = desa;
    }

    /**
     * @return the idPaket
     */
    public String getIdPaket() {
        return idPaket;
    }

    /**
     * @param idPaket the idPaket to set
     */
    public void setIdPaket(String idPaket) {
        this.idPaket = idPaket;
    }

    /**
     * @return the Rute
     */
    public String getRute() {
        return Rute;
    }

    /**
     * @param Rute the Rute to set
     */
    public void setRute(String Rute) {
        this.Rute = Rute;
    }

    /**
     * @param Harga the Harga to set
     */
    public void setHarga(String Harga) {
        this.Harga = Harga;
    }

    /**
     * @return the NamaTourGuide
     */
    public String getNamaTourGuide() {
        return NamaTourGuide;
    }

    /**
     * @param NamaTourGuide the NamaTourGuide to set
     */
    public void setNamaTourGuide(String NamaTourGuide) {
        this.NamaTourGuide = NamaTourGuide;
    }

    /**
     * @return the TanggalBerangkat
     */
    public String getTanggalBerangkat() {
        return TanggalBerangkat;
    }

    /**
     * @param TanggalBerangkat the TanggalBerangkat to set
     */
    public void setTanggalBerangkat(String TanggalBerangkat) {
        this.TanggalBerangkat = TanggalBerangkat;
    }

    /**
     * @return the JamBerangkat
     */
    public String getJamBerangkat() {
        return JamBerangkat;
    }

    /**
     * @param JamBerangkat the JamBerangkat to set
     */
    public void setJamBerangkat(String JamBerangkat) {
        this.JamBerangkat = JamBerangkat;
    }

    /**
     * @return the JamPulang
     */
    public String getJamPulang() {
        return JamPulang;
    }

    /**
     * @param JamPulang the JamPulang to set
     */
    public void setJamPulang(String JamPulang) {
        this.JamPulang = JamPulang;
    }

    /**
     * @return the kuota
     */
    public int getKuota() {
        return kuota;
    }

    /**
     * @param kuota the kuota to set
     */
    public void setKuota(int kuota) {
        this.kuota = kuota;
    }

    /**
     * @return the cover
     */
    public String getCover() {
        return cover;
    }

    /**
     * @param cover the cover to set
     */
    public void setCover(String cover) {
        this.cover = cover;
    }


      Statement stmt = null;
     Connection conn = null;
     ResultSet rs = null;

    public void connect() throws SQLException {
        conn = DataBaseConnection.KoneksiDataBase();
    }

    public ArrayList<Wisata> getDisplay() {
        String sql;
        ArrayList<Wisata> vCatalog = new ArrayList<Wisata>();
        try {
            sql = "SELECT idPaket, namaPaket, rute, harga, kuota, cover from rploinformasi ";
            connect();
            stmt = (Statement) conn.createStatement();
            rs = stmt.executeQuery(sql);
            while (rs.next()) {
                Wisata w = new Wisata();
                w.setIdPaket(rs.getString("idpaket"));
                w.setNamaPaket(rs.getString("namapaket"));
                w.setRute(rs.getString("rute"));
                w.setHarga(Integer.parseInt(rs.getString("harga")));
             //   w.setKuota(Integer.parseInt(rs.getString("kuota")));
                w.setCover(rs.getString("cover"));

                vCatalog.add(w);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return vCatalog;
    }

     public ArrayList<Wisata> getDisplay1() {
        String sql;
        ArrayList<Wisata> vCatalog = new ArrayList<Wisata>();

        try {
            sql = "SELECT idpaket, namapaket,rute,harga,kuota,namatourguide,jamberangkat,cover from rploinformasi ";
            connect();
            stmt = (Statement) conn.createStatement();
            rs = stmt.executeQuery(sql);
            while (rs.next()) {
                Wisata w = new Wisata();
                w.setIdPaket(rs.getString("idpaket"));
                w.setNamaPaket(rs.getString("namapaket"));
                w.setRute(rs.getString("rute"));
                w.setHarga(Integer.parseInt(rs.getString("harga")));
                w.setKuota(Integer.parseInt(rs.getString("kuota")));
                w.setNamaTourGuide(rs.getString("namatourguide"));
               // w.setTanggalBerangkat(rs.getString("tanggalberangkat"));
                w.setJamBerangkat(rs.getString("jamberangkat"));
             //   w.setJamPulang(rs.getString("jampulang"));
                w.setCover(rs.getString("cover"));
                vCatalog.add(w);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return vCatalog;
    }
}
